﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InfoPick.Lib.Entity
{
    public class MTP2LNK
    {
        
        /// <summary>
        /// MTP2链路号
        /// </summary>
        public int MTP2LinkNo { get; set; }

        /// <summary>
        /// 接口板类型
        /// </summary>
        public string BoardTypeName { get; set; }

        //板组号
        public int BoradNum { get; set; }

        /// <summary>
        /// E1T1号，端口号
        /// </summary>
        public int E1T1 { get; set; }

        /// <summary>
        /// 光口号
        /// </summary>
        public int? LightNum { get; set; }

        /// <summary>
        /// 开始时隙号
        /// </summary>
        public int? StartNum { get; set; }

        /// <summary>
        /// 结束时隙号
        /// </summary>
        public int? EndNum { get; set; }

        /// <summary>
        /// SPF板组号
        /// </summary>
        public int SPFBoardNum { get; set; }

        /// <summary>
        /// 扣板号
        /// </summary>
        public int KNum { get; set; }

        public static MTP2LNK Create(string[] row)
        {
            try
            {
                MTP2LNK obj = new MTP2LNK();
                obj.MTP2LinkNo = int.Parse(row[0]);
                obj.BoardTypeName = row[6];
                obj.BoradNum = int.Parse(row[7]);
                int tmp;
                if (int.TryParse(row[8], out tmp))
                    obj.LightNum = tmp;
                obj.E1T1 = int.Parse(row[10]);
                obj.SPFBoardNum = int.Parse(row[3]);
                obj.KNum = int.Parse(row[4]);
                return obj;
            }
            catch (Exception e)
            {
                return null;
            }
        }
    }
}
